package a.e.a;

import a.i.n;

import java.io.IOException;
import java.io.LineNumberReader;
import java.io.PushbackReader;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;

public class j
{
  private a_ a;
  protected static final int b = 0;
  protected static final int c = 1;
  protected static final int d = 2;
  protected static final int e = 3;
  protected static final int f = 4;
  protected static final int g = 5;
  protected static final int h = 6;
  protected static final int i = 7;
  protected static final int j = 8;
  protected static final int k = 9;
  protected static final int l = -1;
  public static boolean m;
  
  public j()
  {
    this(null);
  }
  
  public j(a_ parama_)
  {
    a(parama_);
  }
  
  public void a(Reader paramReader)
    throws IOException
  {
    LineNumberReader localLineNumberReader = new LineNumberReader(paramReader);
    PushbackReader localPushbackReader = new PushbackReader(localLineNumberReader);
    try
    {
      b(localPushbackReader);
    }
    catch (IOException localIOException1)
    {
      IOException localIOException2 = new IOException("Parse error at line " + (localLineNumberReader.getLineNumber() + 1) + ": " + localIOException1.getMessage());
      localIOException2.initCause(localIOException1);
      throw localIOException2;
    }
  }
  
  protected int a(PushbackReader paramPushbackReader)
    throws IOException
  {
    int n = paramPushbackReader.read();
    if (!r.f)
    {
      if (n == -1) {
        return 7;
      }
      paramPushbackReader.unread(n);
    }
    return a((char)n);
  }
  
  protected void b(PushbackReader paramPushbackReader)
    throws IOException
  {
    boolean bool = r.f;
    int i1 = r.e;
    int n = a(paramPushbackReader);
    label48:
    label51:
    label93:
    label112:
    do
    {
      String str;
      Object localObject;
      do
      {
        do
        {
          do
          {
            do
            {
              do
              {
                do
                {
                  if (n == 9)
                  {
                    break label48;
                    break label48;
                    break label48;
                    break label51;
                    break label48;
                  }
                  while (bool)
                  {
                    d(paramPushbackReader);
                    n = a(paramPushbackReader);
                    if ((!bool) && (i1 != 0)) {
                      return;
                    }
                    if (i1 == 0) {
                      break;
                    }
                    break label112;
                  }
                  if (n == 7) {
                    return;
                  }
                  n = a(paramPushbackReader);
                  if (bool) {
                    break label93;
                  }
                  if (n != 4) {
                    break;
                  }
                  c(paramPushbackReader);
                } while ((!bool) && (i1 == 0));
                if (bool) {
                  break label151;
                }
                if (n != 8) {
                  break;
                }
                c(paramPushbackReader);
                n = a(paramPushbackReader);
              } while (n != 9);
              d(paramPushbackReader);
              n = a(paramPushbackReader);
              if ((!bool) && (i1 != 0)) {
                return;
              }
            } while (i1 == 0);
          } while (bool);
          if (bool) {
            break label305;
          }
          if (n != 5) {
            break label303;
          }
          str = e(paramPushbackReader);
          c(paramPushbackReader);
          if (bool) {
            break label227;
          }
          n = a(paramPushbackReader);
          if (n != 0) {
            break;
          }
          this.a.a(str);
          paramPushbackReader.read();
          b(paramPushbackReader);
          if (bool) {
            break label230;
          }
          this.a.b(str);
        } while (i1 == 0);
        localObject = f(paramPushbackReader);
        if (!bool) {
          if ((localObject instanceof String)) {
            this.a.a(str, (String)localObject);
          }
        }
      } while ((!bool) && ((i1 == 0) || (!(localObject instanceof Number))));
      this.a.a(str, (Number)localObject);
    } while ((!bool) && (i1 == 0));
    label151:
    label227:
    label230:
    if (!bool) {
      if (n == 1)
      {
        paramPushbackReader.read();
        return;
      }
    }
    label303:
    label305:
    if (!bool) {
      if (n == -1) {
        throw new IOException("ParseException, did not find LETTER, EOF or ] but '" + (char)paramPushbackReader.read() + '\'');
      }
    }
    if (n != 7) {
      throw new IOException("Malformed GML! Did not find LETTER, EOF or ] but '" + (char)paramPushbackReader.read() + '\'');
    }
  }
  
  protected int a(char paramChar)
  {
    boolean bool = r.f;
    if (!bool) {
      switch (paramChar)
      {
      case '[': 
        return 0;
      case ']': 
        return 1;
      case '&': 
        return 2;
      case '"': 
        return 3;
      case '#': 
        return 9;
      case '+': 
      case '-': 
      case '.': 
        return 6;
      case '\n': 
      case '\f': 
      case '\r': 
        return 8;
      }
    }
    if (!bool) {
      if (Character.isWhitespace(paramChar)) {
        return 4;
      }
    }
    if (!bool) {
      if (Character.isDigit(paramChar)) {
        return 6;
      }
    }
    if (!bool) {
      if (Character.isLetter(paramChar)) {
        return 5;
      }
    }
    return -1;
  }
  
  protected void c(PushbackReader paramPushbackReader)
    throws IOException
  {
    boolean bool = r.f;
    int i2 = r.e;
    int n = paramPushbackReader.read();
    while (n != -1)
    {
      int i1 = a((char)n);
      if (!bool) {
        if (i1 == 4)
        {
          n = paramPushbackReader.read();
          if ((!bool) && (i2 == 0)) {
            continue;
          }
        }
      }
      if (!bool) {
        if (i1 == 8)
        {
          do
          {
            do
            {
              if (i1 != 8) {
                break;
              }
              n = paramPushbackReader.read();
              i1 = a((char)n);
              if (bool) {
                break label138;
              }
              if (i2 != 0) {
                break label137;
              }
            } while (i2 == 0);
          } while (bool);
          if (bool) {
            break label139;
          }
          if (i1 == 9)
          {
            paramPushbackReader.unread(n);
            d(paramPushbackReader);
            n = paramPushbackReader.read();
          }
        }
      }
      label137:
      label138:
      if (((bool) || (i2 != 0)) && (i1 != 4)) {
        label139:
        break;
      }
    }
    if (n != -1) {
      paramPushbackReader.unread(n);
    }
  }
  
  protected void d(PushbackReader paramPushbackReader)
    throws IOException
  {
    boolean bool = r.f;
    int i2 = r.e;
    int n = paramPushbackReader.read();
    if (!bool)
    {
      if ((char)n != '#') {
        throw new IOException("ParseException: expected # but found: " + n);
      }
      n = paramPushbackReader.read();
    }
    do
    {
      int i1 = a((char)n);
      while (i2 == 0)
      {
        if (i1 == 8) {
          break;
        }
        if (!bool)
        {
          if (i1 == 7) {
            break;
          }
          n = paramPushbackReader.read();
          i1 = a((char)n);
        }
      }
      paramPushbackReader.unread(n);
    } while (bool);
  }
  
  protected String e(PushbackReader paramPushbackReader)
    throws IOException
  {
    boolean bool = r.f;
    int i1 = r.e;
    StringBuffer localStringBuffer = new StringBuffer(20);
    int n = paramPushbackReader.read();
    do
    {
      if (n == -1) {
        break;
      }
      if (bool) {
        break label72;
      }
      if (i1 != 0) {
        break label71;
      }
      if (Character.isWhitespace((char)n)) {
        break;
      }
      localStringBuffer.append((char)n);
      n = paramPushbackReader.read();
    } while (i1 == 0);
    label71:
    if ((!bool) && (n != -1)) {
      label72:
      paramPushbackReader.unread(n);
    }
    return localStringBuffer.toString();
  }
  
  protected Object f(PushbackReader paramPushbackReader)
    throws IOException
  {
    boolean bool = r.f;
    int n = a(paramPushbackReader);
    if (!bool) {
      if (n == 3) {
        return h(paramPushbackReader);
      }
    }
    if (!bool) {
      if (n == 0) {
        return k(paramPushbackReader);
      }
    }
    if (n == 6) {
      return g(paramPushbackReader);
    }
    throw new IOException("ParseException, did not find QUOTE, OPEN or DIGIT but '" + Character.toString((char)paramPushbackReader.read()) + "'");
  }
  
  protected Number g(PushbackReader paramPushbackReader)
    throws IOException
  {
    boolean bool = r.f;
    int i2 = r.e;
    StringBuffer localStringBuffer = new StringBuffer(10);
    int n = paramPushbackReader.read();
    int i1 = 1;
    do
    {
      if (Character.isWhitespace((char)n)) {
        break;
      }
      if (i2 != 0) {
        break label128;
      }
      if (i1 != 0)
      {
        if (bool) {
          continue;
        }
        switch (n)
        {
        case 43: 
        case 46: 
        case 69: 
        case 101: 
          i1 = 0;
        }
      }
      localStringBuffer.append((char)n);
      n = paramPushbackReader.read();
    } while (i2 == 0);
    paramPushbackReader.unread(n);
    if ((!bool) && (i1 != 0)) {
      label128:
      return new Integer(localStringBuffer.toString());
    }
    return new Double(localStringBuffer.toString());
  }
  
  protected String h(PushbackReader paramPushbackReader)
    throws IOException
  {
    int n = paramPushbackReader.read();
    if ((char)n != '"') {
      throw new IOException("Expected \" but found " + n);
    }
    String str = i(paramPushbackReader);
    n = paramPushbackReader.read();
    if ((char)n != '"') {
      throw new IOException("Expected \" but found " + n);
    }
    return str;
  }
  
  protected String i(PushbackReader paramPushbackReader)
    throws IOException
  {
    boolean bool = r.f;
    int i1 = r.e;
    StringBuffer localStringBuffer = new StringBuffer(20);
    int n = paramPushbackReader.read();
    if ((char)n != '"') {
      if (!bool)
      {
        if (n == -1) {
          break label82;
        }
        if (bool) {}
      }
      else if ((char)n == '&')
      {
        paramPushbackReader.unread(n);
        n = j(paramPushbackReader);
      }
    }
    label82:
    do
    {
      localStringBuffer.append((char)n);
      n = paramPushbackReader.read();
      if (i1 == 0) {
        break;
      }
      paramPushbackReader.unread(n);
    } while (bool);
    return localStringBuffer.toString();
  }
  
  protected char j(PushbackReader paramPushbackReader)
    throws IOException
  {
    boolean bool = r.f;
    int i1 = r.e;
    int n = paramPushbackReader.read();
    if (!bool) {
      if ((char)n != '&') {
        throw new IOException("Expected & but found " + n);
      }
    }
    n = paramPushbackReader.read();
    StringBuffer localStringBuffer = new StringBuffer(20);
    while (((char)n != ';') && ((bool) || (n != -1)))
    {
      if (!bool) {
        if (!Character.isLetterOrDigit((char)n))
        {
          if (!bool) {
            if ((char)n != '#') {
              break label128;
            }
          }
        }
        else
        {
          localStringBuffer.append((char)n);
          n = paramPushbackReader.read();
        }
      }
      if (i1 != 0) {
        label128:
        throw new IOException("Expected #, letter, digit or ; but found '" + (char)n + "'");
      }
    }
    String str1 = localStringBuffer.toString();
    if (!bool) {
      if (str1.equals("#13")) {
        return '\n';
      }
    }
    if (!bool) {
      if (str1.equals("para")) {
        return '\n';
      }
    }
    if (!bool) {
      if (str1.equals("amp")) {
        return '&';
      }
    }
    if (!bool) {
      if (str1.equals("quot")) {
        return '"';
      }
    }
    String str2;
    if (!bool) {
      if (str1.startsWith("#x"))
      {
        str2 = str1.substring(2);
        return (char)Integer.parseInt(str2, 16);
      }
    }
    if (!bool) {
      if (str1.startsWith("#0x"))
      {
        str2 = str1.substring(3);
        return (char)Integer.parseInt(str2, 16);
      }
    }
    if (!bool) {
      if (str1.startsWith("#"))
      {
        str2 = str1.substring(1);
        return (char)Integer.parseInt(str2);
      }
    }
    return '?';
  }
  
  protected List k(PushbackReader paramPushbackReader)
    throws IOException
  {
    return new ArrayList(0);
  }
  
  public a_ a()
  {
    return this.a;
  }
  
  public void a(a_ parama_)
  {
    this.a = parama_;
  }
  
  public static final class c_
    implements j.a_
  {
    private g a;
    public static boolean b;
    
    public c_(g paramg)
    {
      this.a = paramg;
    }
    
    public void a(String paramString)
    {
      try
      {
        this.a.a(paramString);
      }
      catch (IOException localIOException)
      {
        n.a(localIOException);
      }
    }
    
    public void b(String paramString)
    {
      try
      {
        this.a.b();
      }
      catch (IOException localIOException)
      {
        n.a(localIOException);
      }
    }
    
    public void a(String paramString1, String paramString2)
    {
      try
      {
        this.a.b(paramString1, paramString2);
      }
      catch (IOException localIOException)
      {
        n.a(localIOException);
      }
    }
    
    public void a(String paramString, Number paramNumber)
    {
      try
      {
        this.a.a(paramString, paramNumber);
      }
      catch (IOException localIOException)
      {
        n.a(localIOException);
      }
    }
  }
  
  public static final class b_
    implements j.a_
  {
    public static boolean a;
    
    public void a(String paramString)
    {
      System.out.println("begin scope " + paramString);
    }
    
    public void b(String paramString)
    {
      System.out.println("end scope " + paramString);
    }
    
    public void a(String paramString1, String paramString2)
    {
      System.out.println("string attribute " + paramString1 + " => " + paramString2);
    }
    
    public void a(String paramString, Number paramNumber)
    {
      System.out.println("Number attribute " + paramString + " => " + paramNumber);
    }
  }
  
  public static abstract interface a_
  {
    public abstract void a(String paramString);
    
    public abstract void b(String paramString);
    
    public abstract void a(String paramString1, String paramString2);
    
    public abstract void a(String paramString, Number paramNumber);
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.e.a.j

 * JD-Core Version:    0.7.0.1

 */